package com.hbut.day01;

class Student{
    private String name;
    private int age;
    private String sex;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Student() {
    }

    public Student(String name, int age, String sex) {
        this.name = name;
        this.age = age;
        this.sex = sex;
    }
}
public class Test {
    public static void main(String[] args) {
        String studs ="张三,22,男;李四,21,男;王五,22,女";
        String[] strs = studs.split(";");
        Student[] students = new Student[strs.length];
        //System.out.println(strs.length);
        for (int i = 0; i < strs.length; i++) {
            String[] person = strs[i].split(",");
            //作业
            students[i] = new Student(person[0], Integer.parseInt(person[1]), person[2]);
            System.out.println(students[i].getName()+"\t"+students[i].getAge()+"\t"+students[i].getSex());
        }
    }
}
